package thread;
/**
 * 多线程
 * 多线程可以并发执行多个代码片段。
 *
 * 线程的第一种创建方式:
 * 继承Thread重写run方法。
 */
public class ThreadDemo1 {
    public static void main(String[] args) {
        Thread t1 = new MyThread();
        Thread t2 = new MyThread2();
        t1.start();
        t2.start();
    }
}
class MyThread extends Thread{
    @Override
    public void run() {
        for (int i = 0; i <1000 ; i++) {
            System.out.println("who are you?");
        }
    }
}
class MyThread2 extends  Thread{
    @Override
    public void run() {
        for (int i = 0; i < 1000; i++) {
            System.out.println("窝嫩die");
        }
    }
}
